<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script src="util.js"></script>
    <script>
        pajax({
            url: "http://localhost:3000/news",
            data: {
                author: "tiechui"
            }
        }).then(res => {
            // console.log(res[0]);
            return pajax({
                url: "http://localhost:3000/comments",
                data: {
                    newsId: res[0].id
                }
            })
        }).then(res => {
            // console.log("success" + JSON.stringify(res));
            console.log("success", res);
        }).catch(err => {
            console.log("error" + JSON.stringify(err));
        })
    </script>
</body>

</html>